import {post} from '@/utils/http'


export function userLoginAPI(params) {
  return post('http://localhost:6008/user-client/api/loginInfo/login', params, {
    // 移除JSON格式声明，或显式指定为表单格式
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded' // 关键：指定表单格式
    },
    // 将JSON对象转为表单格式字符串
    transformRequest: [function (data) {
      let ret = ''
      for (let it in data)  {
        ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
      }
      return ret.slice(0, -1)
    }]
  })
}

export function queryPageList(params){
  return post('http://localhost:6013/order-client/cms/customerInfo/queryPageList',params,{
    headers:{
      'Content-Type':'application/json'
    }
  });
}
export function createUser(params){
  return post('http://localhost:6013/order-client/cms/customerInfo/insert',params,{
    headers:{
      'Content-Type':'application/json'
    }
  });
}
export function updateUser(params){
  return post('http://localhost:6013/order-client/cms/customerInfo/update',params,{
    headers:{
      'Content-Type':'application/json'
    }
  });
}
